package com.hangxin.commons.util.bye;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

public class ByteUtil {

	/**
	 * @param args
	 */
	//对象占多少位
	 public static int size(final Object o) throws IOException {
	        if(o==null) {
	            return 0;
	        }
	        ByteArrayOutputStream buf = new ByteArrayOutputStream(4096);
	        ObjectOutputStream out = new ObjectOutputStream(buf);
	        out.writeObject(o);
	        out.flush();
	        buf.close();

	        return buf.size();
	    }
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
